import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';

@Injectable()
export class GoodsTypeService {
    constructor(@InjectModel('GoodsType') private readonly goodsTypeModel) {}
    async find(where = {}, fields = null) {
        return await this.goodsTypeModel.find(where, fields);
    }
    async create(goodsTypeInfo) {
        return await this.goodsTypeModel.create(goodsTypeInfo);
    }
    async update(goodsTypeInfo) {
        return await this.goodsTypeModel.updateOne({ _id: goodsTypeInfo._id }, goodsTypeInfo);
    }
    async delete(goodsTypeInfo) {
        return await this.goodsTypeModel.deleteOne(goodsTypeInfo);
    }
}
